package com.axt.dbaudit.bean.query.report;

import java.util.List;

import com.axt.dbaudit.base.MsgFuncExt;
import com.axt.dbaudit.base.QueryFilter;
import com.axt.dbaudit.base.QueryType;
import com.axt.dbaudit.base.StatDim;
import com.axt.dbaudit.bean.query.QueryBaseBean;
import com.axt.dbaudit.model.query.report.AlarmByClientIp;
import com.axt.dbaudit.model.query.report.AlarmByClientIpSort;
import com.axt.dbaudit.model.query.report.AlarmByTime;

public class QueryReportAlarmBean extends QueryBaseBean{
	
	public List<AlarmByTime> getAlarmByTimes() {
		try {
			return (List<AlarmByTime>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	public List<AlarmByClientIp> getAlarmByClientIps() {
		try {
			return (List<AlarmByClientIp>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	public List<AlarmByClientIpSort> getAlarmByClientIpSorts() {
		try {
			return (List<AlarmByClientIpSort>) getRecord();
		} catch (Exception e) {
			return null;
		}
	}
	
	/* stop query flow report indices */
	public int stopQueryIndices(String serverPath) {

		init();
		setQueryType(QueryType.STAT_T_ALARM);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_STOP_REPORT, serverPath);
	}

	// 按时间统计报警
	public int StatForAlarmsByTimeRgn(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_ALARM);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_TIME_RGN);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 按时间统计报警  查询结果 */
	public int StatForAlarmsByTimeRgnData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_ALARM);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_TIME_RGN);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.AlarmByTime");
	}
	
	// 按客户端IP统计报警
	public int StatForAlarmsByCliIP(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_ALARM);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 按客户端IP统计报警  查询结果 */
	public int StatForAlarmsByCliIPData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_ALARM);
		setQueryInResult(0);
		setSort(0);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.AlarmByClientIp");
	}
	
	// 根据客户端IP排序 全部报警排序
	public int SortForAlarmsByCliIP(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_ALARM);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 根据客户端IP排序 全部报警排序  查询结果 */
	public int SortForAlarmsByCliIPData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_ALARM);
		setQueryInResult(0);
		setSort(-1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.AlarmByClientIpSort");
	}
	
	// 根据客户端IP排序 高排序
	public int SortForAlarmsByCliIPHigh(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_HIGH_ALARM);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 根据客户端IP排序 高报警排序  查询结果 */
	public int SortForAlarmsByCliIPHighData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_HIGH_ALARM);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.AlarmByClientIpSort");
	}
	
	// 根据客户端IP排序 中排序
	public int SortForAlarmsByCliIPMid(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_MID_ALARM);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 根据客户端IP排序 中报警排序  查询结果 */
	public int SortForAlarmsByCliIPMidData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_MID_ALARM);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.AlarmByClientIpSort");
	}
	
	// 根据客户端IP排序 低排序
	public int SortForAlarmsByCliIPLow(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOW_ALARM);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath);
	}

	/* 根据客户端IP排序 低报警排序  查询结果 */
	public int SortForAlarmsByCliIPLowData(String serverPath,
			List<QueryFilter> filters, int maxRowNum) {

		setQueryType(QueryType.STAT_T_LOW_ALARM);
		setQueryInResult(0);
		setSort(1);
		setMaxRowNum(maxRowNum);
		setStatDim(StatDim.AUDIT_STAT_D_CLI_IP);
		setFilters(filters);

		return query(MsgFuncExt.FUNC_QUERY_QUERY_REPORT, serverPath,
				"com.axt.dbaudit.model.query.report.AlarmByClientIpSort");
	}
}
